export default {
  data() {
    return {
      //实现时间限制选择在一个月内而且不能超过当前时间
      pickerOptions: {
        onPick: ({ maxDate, minDate }) => {
          this.cuttentTime = minDate.getTime();
          if (maxDate) {
            this.cuttentTime = "";
          }
        },
        disabledDate: (time) => {
          //获取当前时间戳
          let myDate = new Date();
          let newY = myDate.getFullYear();
          let newM = myDate.getMonth() + 1;
          let newD = myDate.getDate();
          let oldTime =
            newY +
            "-" +
            (newM < 10 ? "0" + newM : newM) +
            "-" +
            (newD < 10 ? "0" + newD : newD) +
            " " +
            "23:59:59";
          // let oldTime="2022-7-5 23:59:59"
          oldTime = new Date(oldTime).getTime(); // 将中国时间转换成毫秒
          // 今天之后的时间不可选
          if (time.getTime() > oldTime) {
            //time.getTime() > Date.now()
            return true;
          }
          //选择日期范围为一个月
          // if (this.cuttentTime != "") {
          //     const one = 30 * 24 * 3600 * 1000;
          //     const minTime = this.cuttentTime - one;
          //     const maxTime = this.cuttentTime + one;
          //     return time.getTime() < minTime || time.getTime() > maxTime;
          // }
        },
      },
      timeArr: [],
      orgName: "",
      selectedValue: "",

      sysInstanceIndex2: 1,
      sysInstanceTotalPages2: 10,
      loading2: false,
      buildings: [],

      buildingsName2: "",
      buildingsName: "",
      classMarkList: [],
    };
  },
  mounted() {},
  methods: {
    // 搜索
    async searchClick1() {
      this.page = 1;
      this.limit = 10;
      this.showPopover = false;
      await this.getDataList();
      // this.clearSelections();
    },
    // 高级搜索重置
    async resetClick() {
      this.handleClear();
      this.searchForm.name = "";
      this.searchForm.code = "";
      this.searchForm.type = "";
      this.searchForm.startTime = "";
      this.searchForm.endTime = "";
      this.timeArr = [];
      this.page = 1;
      this.limit = 10;
      await this.getDataList();
      // this.clearSelections();
    },
    // 清空
    handleClear() {
      this.selectedValue = "";
      this.orgName = "";
      this.sysInstanceIndex = 1;
      this.sysInstanceTotalPages = 10;
      this.orgList = [];
    },
  },
};
